﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HtmlAgilityPack;
using System.Windows.Forms;
using System.IO;

namespace autoBidProject
{
    class Event
    {
        public string xpath;
        public string name_home, name_away;

        public string ft_hdp="", fh_hdp="";

        public float  ft_home, ft_away, ft_over, ft_under;
        public float  fh_home, fh_away, fh_over, fh_under;

        public string ft_home_xpath, ft_away_xpath, ft_over_xpath, ft_under_xpath;
        public string fh_home_xpath, fh_away_xpath, fh_over_xpath, fh_under_xpath;

        public string ft_home_id, ft_away_id, ft_over_id, ft_under_id;
        public string fh_home_id, fh_away_id, fh_over_id, fh_under_id;

        public GlobalVar.ElementType elementSelected;

        public string Name()
        {
            return name_home + " - " + name_away;
        }

        public bool IsCoincideBid(Event e)
        {
            if (this.Name() != e.Name())
                return false;
            
            if ((int)elementSelected < 4)
            {
                if (this.ft_hdp != e.ft_hdp)
                    return false;
            }
            else
                if (this.fh_hdp != e.fh_hdp)
                    return false;

            switch (elementSelected)
            {
                case GlobalVar.ElementType.FT_HOME:
                    return (this.ft_home == e.ft_home);

                case GlobalVar.ElementType.FT_AWAY:
                    return (this.ft_away != e.ft_away);

                case GlobalVar.ElementType.FT_OVER:
                    return (this.ft_over != e.ft_over);

                case GlobalVar.ElementType.FT_UNDER:
                    return (this.ft_under != e.ft_under);


                case GlobalVar.ElementType.FH_HOME:
                    return (this.ft_home != e.ft_home);

                case GlobalVar.ElementType.FH_AWAY:
                    return (this.fh_away != e.fh_away);

                case GlobalVar.ElementType.FH_OVER:
                    return (this.fh_over != e.fh_over);

                case GlobalVar.ElementType.FH_UNDER:
                    return (this.fh_under != e.fh_under);

            }

            return true;
        }
    }
}
